package com.emp.test.springboottest.helper;

public class ParamHelper {

	/**
	 * 根据{@code split}从开始位置{@code start}找到{@code max}个段后的位置信息，如果不足则返回最后的位置
	 * @param param
	 * @param start
	 * @param split
	 * @param max
	 * @return
	 */
	public static final int getNext(String param, int start, char split, int max){

		int endIndex = start;
		int startIndex = start;
		for(int i = 0; i < max; i++){
			startIndex =  param.indexOf(split, startIndex);
			if(-1 == startIndex){
				endIndex = param.length();
				break;
			}
			
			endIndex = startIndex++;
		}
		
		return endIndex - 1;
	}
}
